package main;

import java.io.IOException;
import java.util.Scanner;

import serial.SerialException;
import serial.SerialInterface;

public class SerialKeyboard {

	public static void main(String[] args) throws SerialException, IOException {
		if (args.length < 1) {
			System.out.println("Usage: java SerialKeyboard portName");
			System.exit(1);
		}

		SerialInterface iface = new SerialInterface(new TermDump());
		iface.suggestBestPort(args[0]);

		Scanner s = new Scanner(System.in);
		while (s.hasNextLine()) {
			iface.send(s.nextLine() + "\n", false);
		}
	}

}

